#import "FoursquareTip.h"

//  This Foursquare integration is possible thanks to the Foursquare API by
//  Eric Butler and associates.
//
//  Copyright (C) 2010 Eric Butler <eric@codebutler.com>

/**
 * A FoursquareTip is an object representing a single tip in the
 * Foursquare system.
 *
 * Code used within this class and the supporting API was written by 
 * Eric Butler and other associates.
 *
 * The supporting API can be found in ./FourSquareAPI folder.
 *
 * @author      Eric Butler
 * @author      James Lin
 * @version     2.2.2 
 * @since       2.2.2
 */
@implementation FoursquareTip

@synthesize tipID;            // Identifier of tip
@synthesize tipText;          // Text of tip
@synthesize tipUserID;        // ID of tip creator
@synthesize tipUserFirstName; // First name of tip creator
@synthesize tipUserLastName;  // Last name of tip creator
@synthesize tipVenueID;       // ID of tip venue
@synthesize tipVenueName;     // Name of tip venue
@synthesize tipUserImageURL;  // URL of image of tip creator 
@synthesize tipLocation;      // Location of tip

/**
 * Initialize the Foursquare tip.
 *
 * @param identifier     the identifier for the tip
 * @param text           the text of tip
 * @param userID         the ID of tip creator
 * @param userFirstName  the first name of tip creator
 * @param userLastName   the last name of tip creator
 * @param venueID        the ID of tip venue
 * @param venueName      the name of tip venue
 * @param latitude       the latitude of tip location
 * @param longitude      the longitude of the tip location
 * @return               the initialized Foursquare tip
 */
- (id)initWithID:(NSString*)identifier 
			text:(NSString*)text 
		  userID:(NSString*)userID 
   userFirstName:(NSString*)userFirstName 
	userLastName:(NSString*)userLastName 
		 venueID:(NSString*)venueID  
	   venueName:(NSString*)venueName
		latitude:(NSString*)latitude 
	   longitude:(NSString*)longitude {
	
	if (self = [super init]) {
		self.tipID = identifier;
		self.tipText = text;
		self.tipUserID = userID;
		self.tipUserFirstName = userFirstName ? userFirstName : @"";
		self.tipUserLastName = userLastName ? userLastName : @"";
		self.tipVenueID = venueID;
		self.tipVenueName = venueName;
		tipLocation.latitude = [latitude floatValue]; 
		tipLocation.longitude = [longitude floatValue];
		self.tipUserImageURL = @"";
	}
	
	return self;
}

/**
 * Deallocate the Foursquare tip.
 */
- (void)dealloc {
	[tipID release], tipID = nil;
	[tipText release], tipText = nil;
	[tipUserID release], tipUserID = nil;
	[tipUserFirstName release], tipUserFirstName = nil;
	[tipUserLastName release], tipUserLastName = nil;
	[tipVenueID release], tipVenueID = nil;
	[tipVenueName release], tipVenueName = nil;
	[tipUserImageURL release], tipUserImageURL = nil;
	[super dealloc];
}

@end
